﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using VIBlend.WPF.Controls;

namespace AnonsaiWPF.CSharp.NavigationPaneDemos
{
    /// <summary>
    /// Interaction logic for NavigationPanesLayoutSettings.xaml
    /// </summary>
    public partial class NavigationPanesLayoutSettings : Window, IWindow
    {
        public NavigationPanesLayoutSettings()
        {
            InitializeComponent();
        }

        public void SetTheme()
        {
        }
  
        private void SingleClick_Checked(object sender, RoutedEventArgs e)
        {
            if (this.NavigationPane == null)
                return;

            this.NavigationPane.ExpandType = VIBlend.WPF.Controls.ItemExpandType.SingleClick;


        }

        private void DoubleClick_Checked(object sender, RoutedEventArgs e)
        {
            if (this.NavigationPane == null)
                return;

            this.NavigationPane.ExpandType = VIBlend.WPF.Controls.ItemExpandType.DoubleClick;
        }

        public void DetachContent()
        {
            RemoveLogicalChild(Content);
        }

        public Grid Root
        {
            get
            {
                return this.RootVisual;
            }
        }

        private void MultiExpand_Checked(object sender, RoutedEventArgs e)
        {
            if (this.NavigationPane == null)
                return;

            this.NavigationPane.EnableSingleItemExpand = true;
        }

        private void SingleExpand_Checked(object sender, RoutedEventArgs e)
        {
            if (this.NavigationPane == null)
                return;

            this.NavigationPane.EnableSingleItemExpand = false;
        }

        private void BoundsAnimation_Checked(object sender, RoutedEventArgs e)
        {
            if (this.NavigationPane == null)
                return;

            this.NavigationPane.AnimationType = VIBlend.WPF.Controls.AnimationType.Bounds;
        }

        private void OpacityAnimation_Checked(object sender, RoutedEventArgs e)
        {
            if (this.NavigationPane == null)
                return;

            this.NavigationPane.AnimationType = VIBlend.WPF.Controls.AnimationType.Opacity;
        }

        private void NoneAnimation_Checked(object sender, RoutedEventArgs e)
        {
            if (this.NavigationPane == null)
                return;

            this.NavigationPane.AnimationType = VIBlend.WPF.Controls.AnimationType.None;

        }

        private void SetAlignment(HorizontalAlignment alignment)
        {
            foreach (NavigationPaneItem item in this.NavigationPane.Items)
            {
                item.HorizontalHeaderAlignment = alignment;
            }
        }

        private void Left_Checked(object sender, RoutedEventArgs e)
        {
            if (this.NavigationPane == null)
                return;

            SetAlignment(HorizontalAlignment.Left);
        }

        private void Center_Checked(object sender, RoutedEventArgs e)
        {
            if (this.NavigationPane == null)
                return;

            SetAlignment(HorizontalAlignment.Center);
        }

        private void Right_Checked(object sender, RoutedEventArgs e)
        {
            if (this.NavigationPane == null)
                return;

            SetAlignment(HorizontalAlignment.Right);
        }
    }
}
